package top.huhuiyu.springboot3.p2301.controller.api;

import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import top.huhuiyu.springboot3.p2301.base.R;
import top.huhuiyu.springboot3.p2301.entity.api.GeoResult;
import top.huhuiyu.springboot3.p2301.entity.api.IpResult;
import top.huhuiyu.springboot3.p2301.entity.api.WeatherCasts;
import top.huhuiyu.springboot3.p2301.entity.api.WeatherLives;
import top.huhuiyu.springboot3.p2301.service.api.AMapService;

import java.util.List;

@RestController
@RequiredArgsConstructor
@RequestMapping("/api/amap")
public class AMapController {
    private final AMapService amapService;

    @GetMapping("/weather/base")
    public R<WeatherLives> queryWeatherBase(String city) {
        return amapService.queryWeatherBase(city);
    }

    @GetMapping("/weather/all")
    public R<List<WeatherCasts>> queryWeatherAll(String city) {
        return amapService.queryWeatherAll(city);
    }

    @GetMapping("/ipinfo")
    public R<IpResult> ipinfo(String ip) {
        return amapService.queryIpInfo(ip);
    }

    @GetMapping("/geo")
    public R<GeoResult> geo(String address, String city) {
        return amapService.queryGeo(address, city);
    }


}
